import facade
from logicaltool.BaseTools.file_tools import FileTools
from xjlibrary.our_file_dir import BaseDir

curPath = BaseDir.get_file_dir_absolute(__file__)
configfile = BaseDir.get_new_path(curPath, "db.ini")


class AllUtils(FileTools):
    def __init__(self):
        super().__init__()
        self.conn_sqlite3(r"C:\Users\xuzhu\Desktop\attempt_1559692820011_0119_r_000000_0_siamjournal.db3")
        self.mysqlutils = facade.MysqlUtiles(configfile, "db", logger=self.logger)

    @classmethod
    def mro(cls):
        return cls.mro()

    def selectdb3(self):
        sql = "Select rawid from modify_title_info_zt"
        rows = self.sqlite3utiles.SelectFromSqlliteFetchall(sql)
        for row in rows:
            rawid = "/doi/abs/" + row[0]
            sql = "update article set stat=1 where url='{}'".format(rawid)
            self.mysqlutils.ExeSqlToDB(sql)


if __name__ == "__main__":
    all = AllUtils()
    all.selectdb3()
